import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ShootingRecordVO, ShootingRecordForm, ShootingRecordQuery } from '@/api/system/shootingRecord/types';

/**
 * 查询隐患排查记录列表
 * @param query
 * @returns {*}
 */

export const listShootingRecord = (query?: ShootingRecordQuery): AxiosPromise<ShootingRecordVO[]> => {
  return request({
    url: '/system/shootingRecord/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询隐患排查记录详细
 * @param id
 */
export const getShootingRecord = (id: string | number): AxiosPromise<ShootingRecordVO> => {
  return request({
    url: '/system/shootingRecord/' + id,
    method: 'get'
  });
};

/**
 * 新增隐患排查记录
 * @param data
 */
export const addShootingRecord = (data: ShootingRecordForm) => {
  return request({
    url: '/system/shootingRecord',
    method: 'post',
    data: data
  });
};

/**
 * 修改隐患排查记录
 * @param data
 */
export const updateShootingRecord = (data: ShootingRecordForm) => {
  return request({
    url: '/system/shootingRecord',
    method: 'put',
    data: data
  });
};

/**
 * 删除隐患排查记录
 * @param id
 */
export const delShootingRecord = (id: string | number | Array<string | number>) => {
  return request({
    url: '/system/shootingRecord/' + id,
    method: 'delete'
  });
};
